package com.jxdinfo.hussar.cloud.module.example.tjjc.towerdatahistory.controller;

import com.jxdinfo.hussar.cloud.module.example.tjjc.towerdatahistory.vo.TowerDataHistoryLineVO;
import com.jxdinfo.hussar.cloud.module.example.tjjc.towerdatahistory.vo.TowerDataHistorySearchVO;
import com.jxdinfo.hussar.cloud.module.example.tjjc.towerdatahistory.vo.TowerDataHistoryVO;
import com.jxdinfo.hussar.support.mp.base.controller.HussarBaseController;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.jxdinfo.hussar.support.audit.core.annotations.AuditLog;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.jxdinfo.hussar.support.audit.core.enums.AuditEventGrade;
import com.jxdinfo.hussar.support.audit.core.enums.AuditEventType;
import com.jxdinfo.hussar.cloud.module.example.tjjc.towerdatahistory.model.TowerDataHistory;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.PostMapping;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.jxdinfo.hussar.cloud.module.example.tjjc.towerdatahistory.vo.TowerDataHistoryPageVO;
import org.springframework.beans.factory.annotation.Autowired;
import com.jxdinfo.hussar.cloud.module.example.tjjc.towerdatahistory.service.TowerDataHistoryService;
import com.jxdinfo.hussar.platform.core.base.apiresult.ApiResponse;

import java.util.List;

/**
 * 塔机历史数据控制器
 */
@RestController(value = "tjjc.towerdatahistory.TowerDataHistoryController")
@AuditLog(moduleName = "塔机历史数据")
@RequestMapping(value = "/tjjc/towerDataHistory")
public class TowerDataHistoryController extends HussarBaseController<TowerDataHistory, TowerDataHistoryService> {

    private static final Logger logger = LoggerFactory.getLogger(TowerDataHistoryController.class);

    @Autowired
    private TowerDataHistoryService towerDataHistoryService;

    /**
     * 分页查询塔机历史数据
     *
     * @param towerDataHistorySearchVO 分页对象
     * @return 查询结果
     */
    @AuditLog(moduleName = "塔机历史数据", eventDesc = "表格查询", eventGrade = AuditEventGrade.SERVICE_LOG_TYPE, evnetType = AuditEventType.QUERY)
    @PostMapping("findByPage")
    public ApiResponse<TowerDataHistoryPageVO> findByPage(@RequestBody TowerDataHistorySearchVO towerDataHistorySearchVO) {
        //todo 没有获取项目编号工具类
        return towerDataHistoryService.findByPage(towerDataHistorySearchVO);
    }

    /**
     * 塔机历史数据条件查询
     *
     * @param towerDataHistorySearchVO 分页对象
     * @return 查询结果
     */
    @AuditLog(moduleName = "塔机历史数据", eventDesc = "表格查询", eventGrade = AuditEventGrade.SERVICE_LOG_TYPE, evnetType = AuditEventType.QUERY)
    @PostMapping("findByList")
    public ApiResponse<List<TowerDataHistoryVO>> findByList(@RequestBody TowerDataHistorySearchVO towerDataHistorySearchVO) {
        //todo 没有获取项目编号工具类
        return towerDataHistoryService.findByList(towerDataHistorySearchVO);
    }

    /**
     * 塔机历史数据曲线图查询
     *
     * @param towerDataHistorySearchVO 分页对象
     * @return 查询结果
     */
    @AuditLog(moduleName = "塔机历史数据", eventDesc = "表格查询", eventGrade = AuditEventGrade.SERVICE_LOG_TYPE, evnetType = AuditEventType.QUERY)
    @PostMapping("findByLine")
    public ApiResponse<List<TowerDataHistoryLineVO>> findByLine(@RequestBody TowerDataHistorySearchVO towerDataHistorySearchVO) {
        //todo 没有获取项目编号工具类
        return towerDataHistoryService.findByLine(towerDataHistorySearchVO);
    }

    /**
     * 塔机历史数据曲线图查询
     *
     * @param towerDataHistorySearchVO 分页对象
     * @return 查询结果
     */
    @AuditLog(moduleName = "塔机历史数据", eventDesc = "表格查询", eventGrade = AuditEventGrade.SERVICE_LOG_TYPE, evnetType = AuditEventType.QUERY)
    @PostMapping("findLineChart")
    public ApiResponse<List<TowerDataHistoryVO>> findLineChart(@RequestBody TowerDataHistorySearchVO towerDataHistorySearchVO) {
        //todo 没有获取项目编号工具类
        return towerDataHistoryService.findLineChart(towerDataHistorySearchVO);
    }

    /**
     * 塔机历史数据新增
     *
     * @param towerDataHistorySearchVO
     * @return 查询结果
     */
    @AuditLog(moduleName = "塔机历史数据", eventDesc = "表格查询", eventGrade = AuditEventGrade.SERVICE_LOG_TYPE, evnetType = AuditEventType.INSERT)
    @PostMapping("add")
    public ApiResponse<String> add(@RequestBody TowerDataHistorySearchVO towerDataHistorySearchVO) {
        //todo 没有获取项目编号工具类
        return towerDataHistoryService.add(towerDataHistorySearchVO);
    }

    /**
     * 塔机历史数据修改
     *
     * @param towerDataHistorySearchVO
     * @return 查询结果
     */
    @AuditLog(moduleName = "塔机历史数据", eventDesc = "表格查询", eventGrade = AuditEventGrade.SERVICE_LOG_TYPE, evnetType = AuditEventType.UPDATE)
    @PostMapping("update")
    public ApiResponse<String> update(@RequestBody TowerDataHistorySearchVO towerDataHistorySearchVO) {
        //todo 没有获取项目编号工具类
        return towerDataHistoryService.updateTowerDataHistory(towerDataHistorySearchVO);
    }

    /**
     * 塔机历史数据删除
     *
     * @param towerDataHistorySearchVO
     * @return 查询结果
     */
    @AuditLog(moduleName = "塔机历史数据", eventDesc = "表格查询", eventGrade = AuditEventGrade.SERVICE_LOG_TYPE, evnetType = AuditEventType.UPDATE)
    @PostMapping("deleteById")
    public ApiResponse<String> deleteById(@RequestBody TowerDataHistorySearchVO towerDataHistorySearchVO) {
        //todo 没有获取项目编号工具类
        return towerDataHistoryService.deleteById(towerDataHistorySearchVO);
    }
}
